<?php
/**
 * Created by PhpStorm.
 * User: miidi
 * Date: 2018/7/12
 * Time: 18:03
 */

namespace app\api\model;


class House extends BaseModel
{
    protected $autoWriteTimestamp = 'datetime';

    public function bannerItem()
    {
        return $this->hasMany('Banner', 'type_house_id', 'id');
    }

    public static function getBannerById($id)
    {
        $banner = self::with(['bannerItem'])
            ->find($id);
        return $banner;
    }
}